<template>
    <h2>用户理财明细</h2>
    <table class="table table-bordered">
        <thead>
            <tr>
                <th>用户登录账号</th>
                <th>理财产品名称</th>
                <th>年收益</th>
                <th>购买金额</th>
                <th>购买时间</th>
            </tr>
        </thead>
        <tbody>
            <tr v-for="item in data">
                <td>{{ item.UL_Name }}</td>
                <td>{{ item.F_name }}</td>
                <td>{{ item.F_APY }}</td>
                <td>{{ item.UF_Money }}</td>
                <td>{{ (item.UF_Date).substring(0, 10) }}</td>
            </tr>
        </tbody>
    </table>
</template>

<script setup lang="ts">
import axios from 'axios';
import { ref, onMounted } from 'vue';
import { useRouter, useRoute } from 'vue-router';

// 路由
const router = useRouter()
const route = useRoute()
// 数据
const data = ref([{
    UL_Name: '',
    F_name: '',
    F_APY: 0,
    UF_Money: 0,
    UF_Date: ''
}])
onMounted(() => {
    loadData();
})

//加载数据
const loadData = () => {
    axios.get('https://localhost:44387/api/Finans/ShowUserFinanDetail', {
        params: {
            Fid: route.query.F_id
        }
    }).then(res => {
        console.log(res.data)
        data.value = res.data
    })
}
// 返回
// const back = () => {
//     router.push({
//         path: '/finans'
//     })
// }

</script>
